
#include "stdafx.h"
#include "WicComponentInfo.h"

//==============================================================================
// CWicComponentInfo
//==============================================================================

CWicComponentInfo::CWicComponentInfo(REFCLSID clsidComponent)
{
    m_pIWICComponentInfo = NULL;
    g_hrLast = g_theImagingFactory->CreateComponentInfo(clsidComponent, &m_pIWICComponentInfo);
}

CWicComponentInfo::~CWicComponentInfo()
{
    if(m_pIWICComponentInfo)
    {
        m_pIWICComponentInfo->Release();
    }
    m_pIWICComponentInfo = NULL;
}

CWicComponentInfo::CWicComponentInfo(CWicComponentInfo const & objComponentInfo)
{
    m_pIWICComponentInfo = objComponentInfo.m_pIWICComponentInfo;
    m_pIWICComponentInfo->AddRef();
}

CWicComponentInfo& CWicComponentInfo::operator=(CWicComponentInfo const & objComponentInfo)
{
    if(m_pIWICComponentInfo)
    {
        m_pIWICComponentInfo->Release();
    }
    m_pIWICComponentInfo = objComponentInfo.m_pIWICComponentInfo;
    m_pIWICComponentInfo->AddRef();
    return *this;
}

//==============================================================================
// IWICComponentInfo
//==============================================================================
WICComponentType CWicComponentInfo::GetComponentType()
{
    WICComponentType type;
    g_hrLast = m_pIWICComponentInfo->GetComponentType(&type);
    return type;
}

HRESULT CWicComponentInfo::GetCLSID(/* [out] */ CLSID *pclsid)
{
    g_hrLast = m_pIWICComponentInfo->GetCLSID(pclsid);
    return g_hrLast;
}

DWORD CWicComponentInfo::GetSigningStatus()
{
    DWORD dwStatus = 0;
    g_hrLast = m_pIWICComponentInfo->GetSigningStatus(&dwStatus);
    return dwStatus;
}

UINT CWicComponentInfo::GetAuthor(UINT uBufferLength, WCHAR *wzAuthor)
{
    UINT uResult = 0;
    g_hrLast = m_pIWICComponentInfo->GetAuthor(uBufferLength, wzAuthor, &uResult);
    return uResult;
}

HRESULT CWicComponentInfo::GetVendorGUID(/* [out] */ GUID *pguidVendor)
{
    g_hrLast = m_pIWICComponentInfo->GetVendorGUID(pguidVendor);
    return g_hrLast;
}

UINT CWicComponentInfo::GetVersion(UINT uBufferLength, WCHAR *wzVersion)
{
    UINT uResult = 0;
    g_hrLast = m_pIWICComponentInfo->GetVersion(uBufferLength, wzVersion, &uResult);
    return uResult;
}

UINT CWicComponentInfo::GetSpecVersion(UINT uBufferLength, WCHAR *wzSpecVersion)
{
    UINT uResult = 0;
    g_hrLast = m_pIWICComponentInfo->GetSpecVersion(uBufferLength, wzSpecVersion, &uResult);
    return uResult;
}

UINT CWicComponentInfo::GetFriendlyName(UINT uBufferLength, WCHAR *wzFriendlyName)
{
    UINT uResult = 0;
    g_hrLast = m_pIWICComponentInfo->GetFriendlyName(uBufferLength, wzFriendlyName, &uResult);
    return uResult;
}

